//
//  APWorksDetailCommentVoiceCell.m
//  AqualPolo
//
//  Created by dong on 2024/5/10.
//

#import "APWorksDetailCommentVoiceCell.h"
#import "APVoiceReocrderManager.h"

@implementation APWorksDetailCommentVoiceCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _voiceControl = [[UIControl alloc] init];
        _voiceControl.layer.cornerRadius = 8;
        _voiceControl.backgroundColor = LYRGBColor(87, 61, 255);
        _voiceControl.layer.masksToBounds = true;
        [self.containerView addSubview:_voiceControl];
        [_voiceControl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.avatarImageView.mas_bottom).offset(10);
            make.left.equalTo(self.containerView.mas_left).offset(44);
            make.bottom.equalTo(self.containerView.mas_bottom).offset(-14);
            make.height.mas_equalTo(40);
        }];
        
        _svgaImageView = [[SVGAImageView alloc] init];
        _svgaImageView.imageName = @"speak_voice";
        _svgaImageView.autoPlay = false;
        _svgaImageView.hidden = true;
        [_voiceControl addSubview:_svgaImageView];
        [_svgaImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_voiceControl).offset(20);
            make.centerY.equalTo(_voiceControl);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
        
        _timeLabel = [[UILabel alloc] init];
        _timeLabel.textColor = [UIColor whiteColor];
        _timeLabel.font = [LYFont fontWithSize:16 fontName:LYFontNamepfr];
        _timeLabel.textAlignment = NSTextAlignmentLeft;
        _timeLabel.text = @"1S";
        [_voiceControl addSubview:_timeLabel];
        [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.equalTo(_voiceControl);
            make.left.equalTo(_svgaImageView.mas_right).offset(8);
            make.size.mas_greaterThanOrEqualTo(30);
            make.right.equalTo(_voiceControl.mas_right).offset(-20);
        }];
        
        _voiceIconImageView = [[UIImageView alloc] init];
        _voiceIconImageView.image = [UIImage imageNamed:@"voice_0_icon"];
        [_voiceControl addSubview:_voiceIconImageView];
        [_voiceIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_voiceControl).offset(20);
            make.centerY.equalTo(_voiceControl);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];

    }
    return self;
}

- (void)setCommentModel:(APCommentModel *)commentModel{
    _commentModel = commentModel;
}




@end
